import Mock from 'mockjs';
import shellAssetsJson from '../../data/media2/shellAssets.json';  //last
// import shellAssetsJson from '../../data/audit/subAssets.json';
// import shellAssetsJson from '../../data/media/shellAssetsTwo.json';

export default {
    className: "product.Audit.TurnDown",
    queryData: function(postData) {
        return Mock.mock({
            isSuccess: "Y",
            reason: "",
            message: [],
            "data": {
                "recordCount": 28,
                "pageCount": 1,
                "pageIndex": 1,
                "pageSize": 20,
                "queryResult": shellAssetsJson,
                // "queryResult|28": [{
                //     "keyID|1000-9999": 1000,
                //     "productCode": /^[1-9][1-9][1-9][1-9][1-9][1-9][1-9][1-9]$/,
                //     "productName": Mock.mock('@ctitle'),//@title为英文版
                //     "status": "驳回",
                //     "createTime": Mock.mock('@now'),
                //     "reason": "有不合适画面",
                //     "version": 1
                // }]
            }
        });
    },
    queryByKeyID: function(postData) {

        var curFindObject = null;
        for (var i = 0; i < shellAssetsJson.length; i++) {
            if (postData.keyID == shellAssetsJson[i].keyID) {
                curFindObject = shellAssetsJson[i];
                break;
            }
        }
        if (curFindObject == null) {
            return Mock.mock({
                isSuccess: "Y",
                reason: "",
                message: [],
                "data": {
                    "keyID|1000-9999": 1000,
                    "productCode": /^[1-9][1-9][1-9][1-9][1-9][1-9][1-9][1-9]$/,
                    "productName": Mock.mock('@ctitle'),//@title为英文版
                    "status": "驳回",
                    "createTime": Mock.mock('@now'),
                    "reason": "有不合适画面",
                    "version": 1
                }
            });
        } else {
            return {
                isSuccess: "Y",
                reason: "",
                message: [],
                data: curFindObject,
            };
        }








    },
};
